﻿using AcademiaInteligenteData.BLL;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace AcademiaInteligenteWeb
{
    public partial class MainAcademia : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            grdAcademia.DataKeyNames = new string[] { "id" };
            AtualizarGrid();
        }

        protected void lnkExcluir_Click(object sender, EventArgs e)
        {
            new BoAcademia().ExcluirAcademia(Convert.ToInt32(grdAcademia.SelectedValue));
            AtualizarGrid();
        }

        public void AtualizarGrid()
        {
            grdAcademia.DataSource = new BoAcademia().ListarAcademia();
            grdAcademia.DataBind();
        }
    }
}